<?php
defined('_JEXEC') or die('Restricted access');
$db = JFactory::getDBO();
$query = "SELECT a.auction_date,a.winprice, p.katno, p.km, p.register_day, p.model, p.chassis, p.stand, p.registry FROM #__auction a INNER JOIN #__pr_product p ON a.product_id = p.id WHERE a.id = ".JRequest::getVar('id');
$db->setQuery($query);
$item = $db->loadObject();
?>
<style type="text/css">
/* PRINT*/
p{
	display:block;
	margin-bottom:10px;
	margin-top:10px;
}
a.print-title:link, a.print-title:visited, a.print-title:active
{
    color: #000;
    font-family:Arial;
    font-size:12px; 
    font-weight:bold;
    text-decoration: none;
    text-transform: none;
}
.a.print-title:hover
{
    color: #000;
    font-size:12px;
    font-family:Arial;
    text-decoration: none;
    text-transform: none;
}
.table1{
	border-right:1px gray  solid;
}
.table1 td{
	border-bottom:1px gray  solid;
	border-left:1px gray   solid;
	padding-top:6px;
	padding-left:6px;		
}
</style>

<div style="width:800px; margin:0px auto; font-family:Arial, Helvetica, sans-serif; font-size:14px;;">
    <table style="width: 100%; color:#303030;" cellpadding="0" cellspacing="0">
        <tr>
            <td colspan="4">
            <img src="images/logo1.jpg" alt=""/>
            <p style=" border:1px gray solid; margin-top:5px;"></p>
            </td>
        </tr>
        <tr>
            <td>Bådehavnsgade 46 <br/>2450 København SV</td>
            <td>Tlf. +45 33 21 37 33 <br/>Fax. +45 33 21 37 44</td>
            <td>Mail: info@dabauk.dk <br/>Web: www.dabbilauktion.dk</td>
            <td>Cvr: 33 16 39 16 <br/>
                Bank: Nordea 0040 6274754565</td>
        </tr>
    </table>
    <table style="width: 100%; border:2px gray solid;border-left:none;border-right:none; margin-top:10px;  "> 
        <tr>
            <td style="font-size:30px; font-weight:bold;"><?php echo sprintf("%07d", JRequest::getVar('id'));?></td>
            <td style="font-size:30px;font-weight:bold;" align="center">FAKTURA / INVOICE</td>
            <td width="200" style="font-size:14px; font-weight:bold; line-height:15px;" align="right"><?php echo JRequest::getVar('pf_b');?><br /><?php echo JRequest::getVar('company_b');?><br /><?php echo JRequest::getVar('address_b');?><br /><?php echo JRequest::getVar('by_b');?>
            </td>
        </tr>
    </table>
    <table style="width:100%;" class="table1" cellspacing="0">
        <tr>
            <td>DATO/DATE:<br/> <span style="font-size:18px; font-weight:bold;"><?php echo $item->auction_date?></span></td>
            <td>KATNR/NO.: <br/> <span style="font-size:18px; font-weight:bold;"><?php echo $item->katno?></span></td>
            <td>KM:<br/> <span style="font-size:18px; font-weight:bold;"><?php echo $item->km?></span></td>				
            <td colspan="2">ÅRGANG / YEAR: <br/> <span style="font-size:18px; font-weight:bold;"><?php echo $item->register_day?></span></td>				
        </tr>
        <tr>
            
            <td colspan="3">MÆRKE/MODEL: <br/> <span style="font-size:18px; font-weight:bold;"><?php echo $item->model;?></span></td>
            <td colspan="2">CHASSIS NR./NO: <br/> <span style="font-size:18px; font-weight:bold;"><?php echo $item->chassis;?></span></td>
        </tr>
        <tr>
            <td>KØBESUM/PURCHASE: <br/> <span style="font-size:18px; font-weight:bold;"><?php echo number_format($item->winprice,2,',','')?></span></td>
            <td>MOMS/VAT DKK: <br/> <span style="font-size:18px; font-weight:bold;">0,00</span></td>
            <td>SALÆR/SALERY: <br/> <span style="font-size:18px; font-weight:bold;"><?php echo number_format($salary = $item->winprice/10,2,',','')?></span></td>
            <td>MOMS/VAT: <br/> <span style="font-size:18px; font-weight:bold;"><?php echo number_format($tax = $salary * 0.25,2,',','');?></span></td>	
            <td align="center">KØBESUM/PURCHASE TOTAL: <br/> <span style="font-size:24px; font-weight:bold; "><?php echo number_format($item->winprice + $salary + $tax,2,',','')?></span></td>			
        </tr>
        
    </table>
    <table style="width:100%; ">
        <tr>
            <td rowspan="2" style="width:60%">
                <p style="font-size:20px; margin:0;padding:0;"><?php echo $item->stand?> synes: <?php echo $item->registry?"Ja":"Nej";?> (KBA)</p>
                <p>Jeg erklærer mig indforstået med at ejendomsretten til køretøjet først overgår til mig, når hele købesummen er betalt. Køretøjet er købt som beset uden garanti af nogen art.</p>
                <p>I declare that the ownership of the purchased item is mine, only when the full amount has been payed. The vehicle is bought without any guarantee.</p>
            </td>
            <td height="70"></td>
        </tr>
        <tr>
            <td align="center">
                <hr/>
                <i>Kvittering/signature</i>
                <p><i>FOR MODTAGELSE AF CHECKS, DANKORT OG GIRO TAGES FORBEHOLD FOR DÆKNING</i></p>
            </td>
        </tr>

    </table>
    <p style="border:1px silver dashed; margin-top:40px;"></p>
    <table style="width: 100%; border:2px gray solid;border-left:none;border-right:none; margin-top:60px;  "> 
        <tr>
            <td style="font-size:30px; font-weight:bold;"><?php echo sprintf("%07d", JRequest::getVar('id'));?></td>
            <td style="font-size:30px;font-weight:bold;" align="center">AFREGNING / PAYMENT</td>
            <td  width="200"  style="font-size:14px; font-weight:bold; line-height:15px;" align="right"><?php echo JRequest::getVar('company_s');?><br /><?php echo JRequest::getVar('address_s');?><br /><?php echo JRequest::getVar('by_s');?></td>
        </tr>
    </table>
    <table style="width:100%;" class="table1" cellspacing="0">
        <tr>
            <td>DATO/DATE:<br/> <span style="font-size:18px; font-weight:bold;"><?php echo $item->auction_date?></span></td>
            <td>KATNR/NO.: <br/> <span style="font-size:18px; font-weight:bold;"><?php echo $item->katno?></span></td>
            <td>KM:<br/> <span style="font-size:18px; font-weight:bold;"><?php echo $item->km?></span></td>
            <td>ÅRGANG / YEAR: <br/> <span style="font-size:18px; font-weight:bold;"><?php echo $item->register_day?></span></td>					
            <td >CHASSIS NR./NO: <br/> <span style="font-size:18px; font-weight:bold;"><?php echo $item->chassis;?></span></td>	
                    
        </tr>
        <tr>
            <td colspan="2">MÆRKE/MODEL: <br/> <span style="font-size:18px; font-weight:bold;"><?php echo $item->model;?></span></td>
            <td>DIV/MESC:<br/> <span style="font-size:18px; font-weight:bold; ">0,00</span></td>			
            <td>AFM. NR.PL.:<br/> <span style="font-size:18px; font-weight:bold; ">0,00</span></td>
            <td colspan="1">ANNONCERING/ADVERTISEMENT:<br/> <span style="font-size:18px; font-weight:bold; ">0,00</span></td>			
            
        </tr>
        <tr>
            <td>SALÆR/SALERY: <br/> <span style="font-size:18px; font-weight:bold;"><?php echo number_format($salary + $tax,2,',','')?></span></td>				
            <td>MOMS/VAT DKK: <br/> <span style="font-size:18px; font-weight:bold;">0,00</span></td>
            
            <td>TRANSPORT: <br/> <span style="font-size:18px; font-weight:bold;">0,00</span></td>
            <td>BILBOGSOPL.: <br/> <span style="font-size:18px; font-weight:bold;">0,00</span></td>	
            <td>SALGSPRIS/SALESPRICE: <br/> <span style="font-size:18px; font-weight:bold;"><?php echo number_format($item->winprice,2,',','')?></span></td>          
                        
        </tr>
        
    </table>
    <table style="width:100%; ">
        <tr>
            <td rowspan="2" style="width:60%">
                <p style="font-size:20px;"><?php echo $item->stand?> synes: <?php echo $item->registry?"Ja":"Nej";?> (KBA)<br/>
                CHECKBELØB: <span style="font-size:20px; font-weight:bold;"><?php echo number_format($item->winprice - $salary - $tax,2,',','')?></span></p>
                <p>AFREGNING I FORBINDELSE MED SALG BIL: <span style="font-size:16px; font-weight:bold;">***<?php echo number_format($item->winprice - $salary - $tax,2,',','')?></span><br/><i>ti to tusinde to hundrede femti</i></p>
                <p>Afregning sker under forudsætning af at køretøjet er frit og ubehæftiget.<br/>Final payment made under the condition that the vehicle is mortgage and loan free.</p>
            </td>
            <td height="70"></td>
        </tr>
        <tr>
            <td align="center">
                <hr/>
                <i>Kvittering/signature</i>			
            </td>
        </tr>

    </table>
    <table style="width: 100%; color:#303030;border-top:2px gray solid; padding-top:10px;" cellpadding="0" cellspacing="0">
        <tr>
            <td colspan="4">
            <img src="images/logo1.jpg" alt=""/>
            <p style=" border:1px gray solid; margin-top:10px;"></p>
            </td>
        </tr>
        <tr>
            <td>Bådehavnsgade 46 <br/>2450 København SV</td>
            <td style="width:250px;">Tlf. +45 33 21 37 33 <br/>Fax. +45 33 21 37 44</td>
            <td>Mail: info@dabauk.dk <br/>Web: www.dabbilauktion.dk</td>
            <td>Cvr: 33 16 39 16 <br/>Bank: Nordea 0040 6274754565</td>
        </tr>
    </table>

</div>
<script language="javascript">
	window.print();
	window.onfocus = function() { window.close(); }
</script>